package com.allwees.bs.core.modelbase.transform;

import com.allwees.bs.core.modelbase.entity.WfBaseEntity;
import com.allwees.core.common.util.reflect.PojoUtil;

public abstract class ObjectTransformFactory<F, T> implements TransformFactoryMatcher {

    protected abstract T create();

    protected T transform(F f, T t){
        return PojoUtil.copyWithOmit(t, f, WfBaseEntity.fields);
    }

    protected abstract T perfect(T t);

    public T transform(F f) {
        T t = create();

        transform(f, t);

        perfect(t);

        return t;
    }
}
